/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package medialibrary.persistence;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user
 */
@Entity
@Table(name = "oeuvre")

public class Oeuvre implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "oeuvreISBN")
    private Integer oeuvreISBN;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 32)
    @Column(name = "author")
    private String author;
    @Basic(optional = false)
    @NotNull
    @Column(name = "releaseDate")
    @Temporal(TemporalType.DATE)
    private Date releaseDate;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 32)
    @Column(name = "title")
    private String title;
    @Column(name = "disponibility")
    private Integer disponibility;
    @Size(max = 32)
    @Column(name = "genre")
    private String genre;
    @Size(max = 255)
    @Column(name = "notes")
    private String notes;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "oeuvreISBN")
    private Collection<Ordre> order1Collection;
    @JoinColumn(name = "typeName", referencedColumnName = "typeName")
    @ManyToOne
    private Type typeName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "oeuvreISBN")
    private Collection<Item> itemCollection;

    public Oeuvre() {
    }

    public Oeuvre(Integer oeuvreISBN) {
        this.oeuvreISBN = oeuvreISBN;
    }

    public Oeuvre(Integer oeuvreISBN, String author, Date releaseDate, String title) {
        this.oeuvreISBN = oeuvreISBN;
        this.author = author;
        this.releaseDate = releaseDate;
        this.title = title;
    }

    public Integer getOeuvreISBN() {
        return oeuvreISBN;
    }

    public void setOeuvreISBN(Integer oeuvreISBN) {
        this.oeuvreISBN = oeuvreISBN;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Date getReleaseDate() {
        return releaseDate;
    }

    public void setReleaseDate(Date releaseDate) {
        this.releaseDate = releaseDate;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getDisponibility() {
        return disponibility;
    }

    public void setDisponibility(Integer disponibility) {
        this.disponibility = disponibility;
    }

    public String getGenre() {
        return genre;
    }

    public void setGenre(String genre) {
        this.genre = genre;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public Collection<Ordre> getOrder1Collection() {
        return order1Collection;
    }

    public void setOrder1Collection(Collection<Ordre> order1Collection) {
        this.order1Collection = order1Collection;
    }

    public Type getTypeName() {
        return typeName;
    }

    public void setTypeName(Type typeName) {
        this.typeName = typeName;
    }

    public Collection<Item> getItemCollection() {
        return itemCollection;
    }

    public void setItemCollection(Collection<Item> itemCollection) {
        this.itemCollection = itemCollection;
    }

    public String toString() {
        return oeuvreISBN + "";
    }
    
}
